﻿using System;

namespace Needle.Bus.Engine.Utils
{
    /// <summary>
    /// Usefull class for debugging EngineComponent mutexes
    /// </summary>
    public class NamedMutex
    {
        /// <summary>
        /// Initializes a new instance of the NamedMutex class.
        /// </summary>
        /// <param name="name"></param>
        public NamedMutex(string name)
        {
            if (String.IsNullOrEmpty(name))
                throw new ArgumentException("name is null or empty.", "name");
            _name = name;
        }

        private readonly string _name;
        public string Name
        {
            get { return _name; }
        }
        
        public override string ToString()
        {

            return String.Format("Mutex {0}", _name);
        }

    }
}
